<template>
  <div class="page" data-page="reportApplyDetail" style="z-index: 2;">
    <div class="link-page-nav">
      <a href="#" class="link" id=reportBack>
        <i class="iconfont icon-zuo icon1"></i>
      </a>
      <span class="yearReportTitle">年报</span>
    </div>
    <div class="page-content" id="repotrIframe_content" style="overflow: hidden; height: calc(100% - 38px);">
      <iframe id="repotrIframe" src="" style="width: 100%; height: 100%; border: none;"></iframe>
    </div>
  </div>
</template>
<style>
  .yearReport .link-page-nav {
      background-color: #B14A48;
      display: flex;
      align-items: center;
      height: 38px;
  }
  .yearReport .link-page-nav span {
      text-align: center;
      color: #ffffff;
      font-size: 20px;
      text-indent: -45px;
  }
  .yearReportTitle {
      flex: 1;
  }
</style>
<script>
  return {
    data: function () {
      return {
        reportId: this.$route.params.reportId,
        orgType: this.$route.params.isUnit, // 0-多单位  1-单单位
        reportName: this.$route.params.reportName,
        year: this.$route.params.year,
        period: this.$route.params.period,
      }
    },
    methods: {
      // 显示详情页面 
      showDetail: function () {
        var self = this;
        jQuery('.yearReportTitle').hide()
        if (self.orgType == 0) {
          jQuery('.page').removeClass('yearReport')
          // 月报季报
          if(this.period==2||this.period==5){
            self.url = `${staticPathVue}#/PlatformReport?period=${self.period}&reportId=${self.reportId}`;
          }else{
            self.url = staticPath + 'pages/apply/reportTemplate/regulatorWeekly.html?reportId=' + self.reportId;
          }
        } else if(self.orgType ==1){
          jQuery('.page').removeClass('yearReport')
          // 月报季报
          if(this.period==2||this.period==5){
            self.url = `${staticPathVue}#/UnitReport?period=${self.period}&reportId=${self.reportId}`;
          }else{
            self.url = staticPath + 'pages/apply/reportTemplate/singleWeekly.html?reportId=' + self.reportId;
          }
        }else if(self.orgType==3){//单位年报
          jQuery('.yearReportTitle').show()
          jQuery('.page').addClass('yearReport')
          jQuery('.link-page-nav .iconfont').css({'color':'#FFFFFF'})
          if(self.year&&self.year>2019){
            self.url = `${staticPathVue}#/YearReportUnit?inFrame=1&reportId=${self.reportId}`;
          }else{
            self.url = staticPath + 'pages/apply/reportTemplate/yearReport.html?reportId=' + self.reportId;
          }
        }
        else if(self.orgType==4){// 平台年报
          jQuery('.yearReportTitle').show()
          jQuery('.page').addClass('yearReport')
          jQuery('.link-page-nav .iconfont').css({'color':'#FFFFFF'})
          if(self.year&&self.year>2019){
            self.url = `${staticPathVue}#/YearReportPlatform?inFrame=1&reportId=${self.reportId}`;
            console.log('self.url', self.url)
          }else{
            self.url = staticPath + 'pages/apply/reportTemplate/platformReport.html?reportId=' + self.reportId;
          }
        }
        $("#repotrIframe").attr("src", self.url);
      },
    },
    on: {
      pageInit: function () {
        var self = this;
        $("#reportBack").click(function () {
          Voice.cancel();
          app.methods.backToTab();
        });
        self.showDetail();
      },
      pageAfterOut: function(e, page) {
        jQuery('.page').removeClass('yearReport')
        jQuery('.yearReportTitle').hide()
        jQuery('.link-page-nav .iconfont').css({'color':'#333'})
      
      },
    },

  }
</script>